<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
         <input type="hidden" id="wantedId" name="wantedId" value="${wechatWanted.wantedId!}" >

          <div class="layui-form-item">
              <label class="layui-form-label">期望职位</label>
              <div class="layui-input-block">
                  <input type="text" id="wantedNameId" name="wantedNameId" value="${wechatWanted.wantedNameId!}"  autocomplete="off" placeholder="请输入期望职位"
                         class="layui-input">
              </div>
          </div>









          <#--<div class="layui-form-item">-->
              <#--<label class="layui-form-label">期望薪资</label>-->
              <#--<div class="layui-input-block">-->
                  <#--<input type="text" id="wantedSalary1" name="wantedSalary1" value="${wechatWanted.wantedSalary!}"  autocomplete="off" placeholder="请输入期望薪资"-->
                         <#--class="layui-input">-->
              <#--</div>-->
          <#--</div>-->

    <div class="layui-form-item">
        <label class="layui-form-label">薪资标准</label>
        <div class="layui-input-block">

            <@dict_tag type="salaryStandard">
            <#--  name 和lay-filter 为实体类 的属性 -->
                <select id="wantedSalary" name="positionSalary" lay-filter="positionSalary">
                <option value=""></option>
                <#if dictList?? && dictList?size gt 0>
                    <#list dictList as dict>
                    <#--判断 回显 -->
                        <#if "${dict.dictK}"== "${wechatWanted.wantedSalary!}">
                            <option selected value="${dict.dictK}">${dict.dictVal}</option>
                        <#else>
                            <option value="${dict.dictK}">${dict.dictVal}</option>
                        </#if>
                    </#list>
                </#if>
                </select>
            </@dict_tag>

        </div>
    </div>




          <div class="layui-form-item">
              <label class="layui-form-label">城市名字</label>
              <div class="layui-input-block">
                  <input type="text" id="wantedCity1" name="wantedCity1" value="${wechatWanted.wantedCity!}"  autocomplete="off" placeholder="请输入城市名字"
                         class="layui-input">
              </div>
          </div>

    <div class="layui-form-item">
        <label class="layui-form-label">城市名字 </label>
        <div class="layui-input-block">
            <input type="hidden" value="${wechatWanted.wantedCity!}" id="companyareaids">
            <div class="layui-input-inline">
                <select name="province" lay-filter="province" id="province">
                    <option value="">请选择省</option>
                </select>
            </div>
            <div class="layui-input-inline" style="display: none;" >
                <select name="city" lay-filter="city" id="city">
                    <option value="">请选择市</option>
                </select>
            </div>
            <div class="layui-input-inline" style="display: none;">
                <select name="area" lay-filter="area"  id="area">
                    <option value="">请选择县/区</option>
                </select>
            </div>
            <div class="layui-input-inline" style="display: none;" >
                <select name="street" lay-filter="street" id="street">
                    <option value="">请选择街道</option>
                </select>
            </div>
        </div>
    </div>


    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script src="${base}/static/win10/js/areaCallBack.js"></script>
<script>
    layui.use(['form', 'layer'], function() {
        var form = layui.form
                , layer = layui.layer;
        $("#submit").on("click",function () {

            areaids = $("#province").val()+","+$("#city").val()+","+$("#area").val()+","+$("#street").val() ;

            if(check()===false){
                return;
            }

            var formDate = {
                         wantedId:$("#wantedId").val(),
                         wantedNameId:$("#wantedNameId").val(),
                         wantedSalary:$("#wantedSalary").val(),
                           wantedCity:areaids
            }
            $.ajax({
                type: "POST",
                url: base+"/WeChatUser/wechatWanted/admin/editWechatWanted",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href=base+"/WeChatUser/wechatWanted/admin/main.html"
                    } else {

                    }
                }
            });
        })







        function check(){
                   if($("#wantedNameId").val().length<1){
                       layer.msg("请输入期望职位");
                       return false;
                   }
                   if($("#wantedSalary").val().length<1){
                       layer.msg("请输入期望薪资");
                       return false;
                   }
                   if(areaids.length<1){
                       layer.msg("请输入城市名字");
                       return false;
                   }
        }
    });

</script>
</body>
</html>